<?php
namespace Tbf\Component\DateTime;
class DateTimeFunction {
    public static function fromMysqlDateTime($string){
        return \DateTime::createFromFormat('Y-m-d H:i:s',$string);
    }
    public static function toMysqlDateTime(\DateTime $datetime){
        return $datetime->format('Y-m-d H:i:s');
    }
    public static function fromUnixTime($time){
        return \DateTime::createFromFormat('U',$time);
    }
    public static function toUnixTime(\DateTime $datetime){
        return $datetime->format('U');
    }
    public static function fromMysqlDateTimeToUnixTime($time){
        return self::toUnixTime(self::fromMysqlDateTime($time));
    }
}